/*
 * Copyright© 2003-2019 浙江汇信科技有限公司, All Rights Reserved. 
 */
package com.icinfo.cloud.provider.punish.service.impl;

import com.icinfo.cloud.provider.punish.mapper.CaseMainDetailSimpleInfoMapper;
import com.icinfo.cloud.provider.punish.service.ICaseMainDetailSimpleInfoService;
import com.icinfo.cloud.provider.punish.ucase.casemain.model.CaseMainDetailSimpleInfo;
import com.icinfo.framework.core.service.support.MyBatisServiceSupport;
import com.icinfo.framework.mybatis.mapper.entity.Example;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;

import javax.annotation.Resource;
import java.util.List;

/**
 * 描述: 简易案件详情表（宽表） case_main_detail_simple_info 对应的Service接口实现类.<br>
 *
 * @author framework generator
 * @date 2022年06月14日
 */
@Service
public class CaseMainDetailSimpleInfoServiceImpl extends MyBatisServiceSupport implements ICaseMainDetailSimpleInfoService {
    /**
     * 日志记录器
     */
    private static final Logger logger = LoggerFactory.getLogger(CaseMainDetailSimpleInfoServiceImpl.class);

    @Resource
    private CaseMainDetailSimpleInfoMapper caseMainDetailSimpleInfoMapper;

    /**
     * 描述： 根据案件id获取简易处罚详情信息
     *
     * @author: zhengqiang
     * @date: 2022/6/21
     * @param: caseId
     * @return {@link CaseMainDetailSimpleInfo}
     **/
    public CaseMainDetailSimpleInfo getCaseMainDetailSimpleInfo(String caseId) {
        Example queryExample = new Example(CaseMainDetailSimpleInfo.class);
        queryExample.createCriteria().andEqualTo("caseId", caseId);
        List<CaseMainDetailSimpleInfo> caseMainDetailSimpleInfos = caseMainDetailSimpleInfoMapper.selectByExample(queryExample);
        if (!ObjectUtils.isEmpty(caseMainDetailSimpleInfos)) {
            return caseMainDetailSimpleInfos.get(0);
        }
        return null;
    }
}